from model import db
import datetime


class Tag(db.Model):
    __tablename__ = "tag"  # 映射的数据表，不写默认是类名
    id = db.Column(db.Integer, primary_key=True, autoincrement=True)
    name = db.Column(db.String(128), nullable=False, unique=True)
    CreateAt = db.Column(db.DateTime, default=datetime.datetime.now())

    def keys(self):
        return ("id", 'name', 'CreateAt')

    def __getitem__(self, item):
        return getattr(self, item)
